import React from 'react'
import { Navigate } from 'react-router-dom'
import { hasToken } from 'utils/storage'

export default function AuthRoute({ children }) {
  if (hasToken()) {
    return <>{children}</>
  } else {
    return (
      <>
        <Navigate to='/login'></Navigate>
      </>
    )
  }
}
